﻿#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "filter/gaussianFilter1D.h"
#include <vector>


using std::vector;
using Catch::Matchers::WithinAbs;

TEST_CASE("gaussianFilter1D", "[gaussianFilter1D]")
{
    INFO("CTEST_FULL_OUTPUT");
    vector<double> signal = {1, 2, 3, 4, 5, 6, 7, 8, 9};
    auto filtered = gaussianFilter1D(signal, 5, 1.0); // 核大小5，σ=1.0

    CHECK_THAT(filtered[0], WithinAbs(1.05, 0.1));
    CHECK_THAT(filtered[1], WithinAbs(2, 0.1));
    CHECK_THAT(filtered[2], WithinAbs(3, 0.1));
    CHECK_THAT(filtered[3], WithinAbs(4, 0.1));
    CHECK_THAT(filtered[4], WithinAbs(5, 0.1));
    CHECK_THAT(filtered[5], WithinAbs(6, 0.1));
    CHECK_THAT(filtered[6], WithinAbs(7, 0.1));
    CHECK_THAT(filtered[7], WithinAbs(7.45, 0.1));
    CHECK_THAT(filtered[8], WithinAbs(5.95, 0.1));
}
